#include "errorhandler.h"

void err(ERROR error)
{
    // 函数实现
    switch(error)
    {
        case INSTRUCTION_NUMS_ERROR:
        cout<<"操作数量错误"<<endl;
        break;
        case INSTRUCTION_NO_FIND:
        cout<<"指令未找到"<<endl;
        break;
        case OPERAND_TYPE_ERROR:
        cout<<"操作数类型错误"<<endl;
        break;
        case NO_FIND_IN_SYMBOLTABLE:
        cout<<"符号表中无此变量"<<endl;
        break;
        case OPENING_ERROR:
        cout<<"打开文件失败"<<endl;
        break;
        case ILLEGAL_CHARACTER:
        cout<<"非法字符"<<endl;
        break;                              
    }
    //如果有错强制退出
    if(error != NO_ERROR)exit(1);

}
